import request from '@u/request'
import { HttpMethod } from '@u/http'

// 查询列表
export function listProduct(query) {
  return request({
    url: '/beauty/product/list',
    method: HttpMethod.GET,
    params: query
  })
}

// 查询
export function getProduct(id) {
  return request({
    url: '/beauty/product/' + id,
    method: HttpMethod.GET
  })
}

// 新增
export function addProduct(data) {
  return request({
    url: '/beauty/product',
    method: HttpMethod.POST,
    data: data
  })
}

// 修改
export function updateProduct(data) {
  return request({
    url: '/beauty/product',
    method: HttpMethod.PUT,
    data: data
  })
}

// 删除
export function delProduct(id) {
  return request({
    url: '/beauty/product/' + id,
    method: HttpMethod.DELETE
  })
}

// 修改上架状态
export function changePublishStatus(productId, status) {
  return request({
    url: `/beauty/product/changePublishStatus/${productId}/${status}`,
    method: HttpMethod.PUT
  })
}

// 修改状态
export function changeStatus(productId, status) {
  return request({
    url: `/beauty/product/changeStatus/${productId}/${status}`,
    method: HttpMethod.PUT
  })
}

// 修改推荐状态
export function changeRecommandStatus(productId, status) {
  return request({
    url: `/beauty/product/changeRecommandStatus/${productId}/${status}`,
    method: HttpMethod.PUT
  })
}

// 修改审核状态
export function changeVerifyStatus(productId, status) {
  return request({
    url: `/beauty/product/changeVerifyStatus/${productId}/${status}`,
    method: HttpMethod.PUT
  })
}

// 修改新品状态
export function changeNewStatus(productId, status) {
  return request({
    url: `/beauty/product/changeNewStatus/${productId}/${status}`,
    method: HttpMethod.PUT
  })
}
